#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2024/3/8 19:26
# @Author  : jeff
# @FileName: app
import os
from src.utils.read_config import app_config
from loguru import logger
from src.config.app_config import create_app
from src.utils.dir import root_dir

app = create_app()
file_name = "banner.txt"
file_path = os.path.normpath(os.path.join(root_dir, file_name))
host, port, debug, use_reloader = app_config()

with open(file_path, 'r') as f:
    line = f.readline()
    while line:
        logger.info(line.strip())
        line = f.readline()

if __name__ == '__main__':
    # serve(app, host=host, port=port)  # Start with waitress, recommended for remote environment
    app.run(
        host=host,  # Remote access needs to be set to: 0.0.0.0, local debugging can be removed
        debug=debug,
        use_reloader=use_reloader,  # Hot update
        port=port
    )
